<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>骡窝窝系统管理平台</title>
    <#include "../common/header.ftl"/>
    <script type="text/javascript" src="/js/plugins/My97DatePicker/WdatePicker.js"></script>
</head>

<body>
<div class="container">
<#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
		<#assign currentMenu = "travelCommend" />
        <#include "../common/menu.ftl" />
        </div>
        <div class="col-sm-9">
            <div class="page-header">
                <h3>推荐游记管理</h3>
            </div>
            <div class="row">
                <!-- 提交分页的表单 -->
                <form id="searchForm" class="form-inline" method="post" action="/travelCommend/list.do">
                    <input type="hidden" name="currentPage" id="currentPage" value="1"/>
                    <div class="form-group">
                        <label>状态</label>
                        <select id="auditState" class="form-control"  name="type">
                            <option value="-2">全部</option>
                            <option value="2">每周推荐</option>
                            <option value="1">每月推荐</option>
                            <option value="3">攻略推荐</option>
                        </select>
                        <button id="query" type="button" class="btn btn-success"><i class="icon-search"></i>查询</button>
                    </div>
                </form>
            </div>
            <script>
                $("#auditState").val("${(qo.type)!}");
            </script>
            <div class="row">
                <table class="table">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>标题</th>
                        <th>封面</th>
                        <th>副标题</th>
                        <th>推荐时间安排</th>
                        <th>攻略类型</th>
                        <th></th>
                        <th></th>
                    </tr>

                    </thead>
                    <tbody>
					<#list pageInfo.list as entity>
                    <tr>
                        <td>${entity_index +  1}</td>
                        <td>${entity.title!""}</td>
                        <td><img src='${entity.coverUrl!"" }' width="100px"/></td>
                        <td>${entity.subTitle!""}</td>
                        <td>${entity.schedule?string("yyyy-MM-dd")}</td>
                        <td>${entity.typeName!""}</td>
                        <td><a class="commendBtn"  data-json='${entity.json}'>修改</a></td>
                    </tr>
					</#list>
                    </tbody>
                </table>
                <#include "../common/page.ftl"/>
            </div>
        </div>
    </div>
</div>
<div id="travelCommendModal" class="modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">编辑/增加</h4>
            </div>
            <div class="modal-body">
                <form id="commendForm" class="form-horizontal" method="post" action="/travelCommend/saveOrUpdate.do" enctype="multipart/form-data" style="margin: -3px 118px">
                    <input id="travelCommendId" type="hidden" name="id" />
                    <input id="travelCommendId" type="hidden" name="travelId" />
                    <div class="form-group">
                        <label class="col-sm-4 control-label">标题</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="title" placeholder="标题">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">副标题</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="subTitle" placeholder="副标题">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">封面</label>
                        <div class="col-sm-6">
                            <img width="200px"/>
                            <input type="hidden" name="coverUrl"  >
                            <input type="file" class="form-control"  name="file" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">推荐时间</label>
                        <div class="col-sm-6">
                            <input type="text" name="schedule" class="form-control" onclick="WdatePicker()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">推荐类型</label>
                        <div class="col-sm-6">
                            <select class="form-control" autocomplete="off" name="type" >
                                <option value="1">每月推荐</option>
                                <option value="2">每周推荐</option>
                                <option value="3">攻略推荐</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" style="text-align: center">
                        <a href="javascript:void(0)" target="_blank" id="skip" data-url="/travelRelease/list.do?travelId=">点击查看游记文章明细</a>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <a href="javascript:void(0);" class="btn btn-success" id="saveCommendBtn" aria-hidden="true">保存</a>
                <a href="javascript:void(0);" class="btn" data-dismiss="modal" aria-hidden="true">关闭</a>
            </div>
        </div>
    </div>
</div>
<div id="travelCommendModal" class="modal" tabindex="-1" role="dialog" >
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title contentTitle"></h4>
            </div>
            <div class="modal-body content">
            </div>
            <div class="modal-footer">
                <a href="javascript:void(0);" class="btn" data-dismiss="modal" aria-hidden="true">关闭</a>
            </div>
        </div>
    </div>
</div>
<style>
    #travelCommendModal img {
        width: 100%;
    }
</style>
<script>
    $("#query").click(function () {
        $("#searchForm").submit();
    });
    $("#auditState").val(${qo.type});


    $(".commendBtn").click(function () {
        var json = $(this).data("json");
        $("#commendForm input[name='id']").val(json.id);
        $("#commendForm input[name='travelId']").val(json.travelId);
        $("#commendForm input[name='title']").val(json.title);
        $("#commendForm input[name='subTitle']").val(json.subTitle);
        $("#commendForm img").attr("src",json.coverUrl);
        $("#commendForm input[name='coverUrl']").val(json.coverUrl);
        $("#commendForm input[name='schedule']").val(json.schedule);
        $("#commendForm select[name='type']").val(json.type);
        $("#skip").attr("href",$("#skip").data("url")+json.travelId)
        $("#travelCommendModal").modal("show");
    });
    $("#saveCommendBtn").click(function () {
        $("#commendForm").submit();
    });
</script>
</body>
</html>